#
study_name = 'study_PL_buckle_diameter'
#
import numpy as np
#
source_python = r'\\MA-CASTRO\abaqus-conecyl-python'
import sys
import os
study_dir  = os.path.join( r'C:\Temp','abaqus',study_name )
if not os.path.isdir( study_dir ):
    os.makedirs( study_dir )
python_dir = os.path.join( study_dir, 'abaqus-conecyl-python' )
output_dir = os.path.join( study_dir,'outputs' )
print 'configuring folders...'
print '\t' + python_dir
print '\t' + output_dir
if not os.path.isdir( output_dir ):
    os.makedirs( output_dir )
if not os.path.isdir( python_dir ):
    os.makedirs( python_dir )
os.system('copy ' + source_python + ' ' + python_dir + '') 
sys.path.append( python_dir )
#
import study
study = reload( study )
from study import Study
std = Study()
std.name = study_name
std.rebuild()
ccname = 'astrium_des1'
ploads = [2.,6.,10.,12.,16.,20.]
#ploads = [2.,4.]
for pload in ploads: 
    cc = std.add_cc_fromDB( ccname )
    cc.ploadconf.ploads = []
    cc.ploadconf.add_pload( theta=  0.,
                            pt = 0.5,
                            pltotal = pload )
    cc.numel_r = 80.
    cc.axialdispl = 10.
    cc.separate_load_steps = True
    #cc.axialInclude = False
    #cc.meshname = 'ONLY_PL'
    cc.rebuild() 
    std.add_cc( cc )
std.create_models()
    #cc.plot_displacements( step_num = 1 )
    #cc.plot_displacements( step_num = 2 )
    #cc.plot_forces( step_num = 1 )
    #cc.plot_forces( step_num = 2 )
    #cc.ploadconf.ploads[0].calc_ehr_and_displ() 
